#include <iostream>
#include <Eigen/Dense>
#include <ctime>
#include <cstdlib>
#include <math.h>
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include <fstream>
#include<iomanip>
//#include "Person.h"


using namespace cv;

//根据CSDN某开源代码改进
//灯条识别的类
class LightDescriptor
{
public:
    //LightDescriptor() {};
    LightDescriptor(const cv::RotatedRect& light)
    {
        width = light.size.width;
        length = light.size.height;
        center = light.center;
        angle = light.angle;
        area = light.size.area();
        brect = light.boundingRect();
    }
    const LightDescriptor& operator =(const LightDescriptor& ld)
    {
        this->width = ld.width;
        this->length = ld.length;
        this->center = ld.center;
        this->angle = ld.angle;
        this->area = ld.area;
        this->brect=ld.brect;
        return *this;
    }

    cv::RotatedRect rec() const
    {
        return cv::RotatedRect(center, cv::Size2f(width, length), angle);
    }

    void draw(Mat img){
        cv::rectangle(img, brect, Scalar(0, 255, 0), 2);
    }

public:
    float width;
    float length;
    cv::Point2f center;
    float angle;
    float area;
    Rect brect;
};
